//
//  StatusOriginalCell.swift
//  sinaWeibo
//
//  Created by 张国梁 on 16/4/14.
//  Copyright © 2016年 CoderGL. All rights reserved.
//

import UIKit

class StatusOriginalCell: StatusCell {
    
    override var status: Status?{
        didSet{
            pictureView.status = status
            pictureViewW?.constant = (status?.calculateImageSize().width)!
            pictureViewH?.constant = (status?.calculateImageSize().height)!
            pictureViewT?.constant = status?.calculateImageSize().height == 0 ? 0 : margin
        }
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        let cons = pictureView.xmg_AlignVertical(type: XMG_AlignType.BottomLeft, referView: contentLabel, size: CGSizeMake(width, width), offset: CGPointMake(0, margin))
        
        pictureViewW = pictureView.xmg_Constraint(cons, attribute: NSLayoutAttribute.Width)
        pictureViewH = pictureView.xmg_Constraint(cons, attribute: .Height)
        
        toolBar.xmg_AlignVertical(type: XMG_AlignType.BottomLeft, referView: pictureView, size: CGSizeMake(screenW, toolBarH), offset: CGPointMake(-margin, margin))
          
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
